<html>
<head>
<title>test for element present</title>		

<script type="text/Javascript">

	function createLink(){
		linkContainer().innerHTML = 
		"<a id='aLink' href='about:blank'>here is a link</a>"
	}			

function removeTheLink(){				
	var link = document.getElementById("aLink");
	if(link) linkContainer().removeChild(link);
}

function linkContainer(){
	return document.getElementById('linkContainer');
}

</script>

</head>


<body>


<br>
<div id="linkContainer">
</div>
<br>

<button id="removeLinkAfterAWhile" onclick="javascript:
	setTimeout('removeTheLink();',150)">
	click to remove the link after a while
</button>

<br>

<br>

<button id="addLinkAfterAWhile" onclick="javascript:
	setTimeout('createLink();',150)">
	click to add the link back after a while
</button>

<script type="text/Javascript">
	createLink();
</script>

</body>
</html>	
